﻿<path stroke="@Node.NodeData.BorderColor"
      stroke-width="@Node.NodeData.BorderWidth"
      width="@Node.NodeData.Width"
      height="@Node.NodeData.Height"
      d="m0,@(Node.NodeData.Height/2)l@(Node.NodeData.Width/2),-@(Node.NodeData.Height/2)l@(Node.NodeData.Width/2),@(Node.NodeData.Height/2)l-@(Node.NodeData.Width/2),@(Node.NodeData.Height/2)l-@(Node.NodeData.Width/2),-@(Node.NodeData.Height/2)z"
      fill="@Node.NodeData.FillColor" />
<text y="@(Node.NodeData.Height/2+Node.NodeData.FontSize/2)" x="@(Node.NodeData.Width/2)"
      width="@Node.NodeData.Width" height="@Node.NodeData.Width"
      style="text-anchor:middle;font-size:@(Node.NodeData.FontSize)px">
    <tspan font-weight="bold" fill="@Node.NodeData.TextColor">@Node.NodeData.NodeModelName</tspan>
</text>
@if (Node != null)
{
 @*    @if (Node.GetPort(PortAlignment.TopLeft) != null)
    {
        <PortRenderer Port="Node.GetPort(PortAlignment.TopLeft)">
            <circle class="port" cx="10" cy="10" r="10"></circle>
        </PortRenderer>
    } *@
    @if (Node.GetPort(PortAlignment.Top) != null)
    {
        <PortRenderer Port="Node.GetPort(PortAlignment.Top)">
            <circle class="port" cx="@(Node.NodeData.Width/2)" cy="10" r="10"></circle>
        </PortRenderer>
    }
@*     @if (Node.GetPort(PortAlignment.TopRight) != null)
    {
        <PortRenderer Port="Node.GetPort(PortAlignment.TopRight)">
            <circle class="port" cx="80" cy="10" r="10"></circle>
        </PortRenderer>
    } *@
 @*    @if (Node.GetPort(PortAlignment.BottomLeft) != null)
    {
        <PortRenderer Port="Node.GetPort(PortAlignment.BottomLeft)">
            <circle class="port" cx="10" cy="80" r="10"></circle>
        </PortRenderer>
    } *@
    @if (Node.GetPort(PortAlignment.Bottom) != null)
    {
        var xx = Node.NodeData;
        ;
        <PortRenderer Port="Node.GetPort(PortAlignment.Bottom)">
            <circle class="port" cx="@(Node.NodeData.Width/2)" cy="@(Node.NodeData.Height-10)" r="10"></circle>
        </PortRenderer>
    }
@*     @if (Node.GetPort(PortAlignment.BottomRight) != null)
    {
        <PortRenderer Port="Node.GetPort(PortAlignment.BottomRight)">
            <circle class="port" cx="80" cy="80" r="10"></circle>
        </PortRenderer>
    } *@
    @if (Node.GetPort(PortAlignment.Left) != null)
    {
        <PortRenderer Port="Node.GetPort(PortAlignment.Left)">
            <circle class="port" cx="10" cy="@(Node.NodeData.Height/2)" r="10"></circle>
        </PortRenderer>
    }
    @if (Node.GetPort(PortAlignment.Right) != null)
    {
        <PortRenderer Port="Node.GetPort(PortAlignment.Right)">
            <circle class="port" cx="@(Node.NodeData.Width-10)" cy="@(Node.NodeData.Height/2)" r="10"></circle>
        </PortRenderer>
    }

}
@code {
    [Parameter]
    [NotNull]
    public CustomNode? Node { get; set; }
}
